SetContextualSpacing
Specifies that any space before or after this paragraph set using the {@link ApiParaPr#SetSpacingBefore} or {@link ApiParaPr#SetSpacingAfter} spacing element, should not be applied when the preceding and following paragraphs are of the same paragraph style, affecting the top and bottom spacing respectively.
Syntax
expression.SetContextualSpacing(isContextualSpacing);
expression
- A variable that represents a ApiParaPr class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
isContextualSpacing | Required | boolean | The true value will enable the paragraph contextual spacing. |
Returns
This method doesn't return any data.
Example
This example specifies that any space before or after this paragraph set using the ApiParaPr#SetSpacingBefore or ApiParaPr#SetSpacingAfter spacing element, should not be applied when the preceding and following paragraphs are of the same paragraph style, affecting the top and bottom spacing respectively.
let doc = Api.GetDocument();
let myStyle = doc.CreateStyle("My document style");
let paraPr = myStyle.GetParaPr();
paraPr.SetContextualSpacing(true);
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a paragraph with contextual spacing set to 'false' (no paragraph style is applied).");
paragraph = Api.CreateParagraph();
paragraph.AddText("This is a paragraph with contextual spacing set to 'false' (no paragraph style is applied).");
doc.Push(paragraph);
paragraph = Api.CreateParagraph();
paragraph.SetStyle(myStyle);
paragraph.AddText("This is a paragraph with contextual spacing set to 'true' (paragraph style is applied).");
doc.Push(paragraph);
paragraph = Api.CreateParagraph();
paragraph.SetStyle(myStyle);
paragraph.AddText("This is a paragraph with contextual spacing set to 'true' (paragraph style is applied).");
doc.Push(paragraph);